package com.alan.service.impl;

import com.alan.entity.teacherstudent;
import com.alan.repository.TeacherRepository;
import com.alan.repository.impl.TeacherRepositoryImpl;
import com.alan.service.TeacherService;

import java.util.List;

public class TeacherServiceIpml implements TeacherService {
    private TeacherRepository teacherRepository = new TeacherRepositoryImpl();
    private final int LIMIT = 10;

    @Override
    public List<teacherstudent> findall(String stu_classs, int page) {
        int index = (page - 1) * LIMIT;
        return teacherRepository.findall(stu_classs, index, LIMIT);

    }

    @Override
    public int getsumpages(String stu_class) {
        int counts = teacherRepository.counts(stu_class);
        return (counts + 10) / LIMIT;
    }
}
